package com.controller.vo;

import org.springframework.beans.BeanUtils;

import com.controller.vo.base.BaseVo;
import com.dao.entity.Commissioner;

public class CommisVo extends BaseVo{

	private String account;

	private String userName;
    
    private String idCard;
    
    private String openId;
    
    private int sex;
    
    public CommisVo(Commissioner comm) {
    	if(comm != null)
    		BeanUtils.copyProperties(comm, this);
	}
    
    public Commissioner toPo() {
    	Commissioner co = new Commissioner();
    	BeanUtils.copyProperties(this, co, "updatedate", "createdate");
    	return co;
    }

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getIdCard() {
		return idCard;
	}
	
	public String getIdCardBlur() {
		if(idCard != null) {
			int i = idCard.length();
			String start = idCard.substring(0, 4);
			String end = idCard.substring(i-4, i);
			return start + "*****" + end;
		}
		return null;
	}
	
	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public int getSex() {
		return sex;
	}
	
	public String getSexText() {
		switch (this.sex){
		case 1:
			return "男";
		case 0:
			return "女";
		}
		return "女";
	}

	public void setSex(int sex) {
		this.sex = sex;
	}
	
}
